import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.stream.Stream;

public class java3 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String str=sc.nextLine();
        Map<Character, Integer> map=new HashMap<>();
        char[] arr=str.toCharArray();
        for (int i = 0; i < arr.length ; i++) {
            char key=arr[i];
            if(map.containsKey(key)){
                int n= map.get(key);
                map.put(key,n+1);
            }else{
                map.put(key,1);
            }
        }
        int n= sc.nextInt();
        map.entrySet().stream()
                .filter(s -> s.getValue() == n)
                .forEach(s -> System.out.println(s.getKey()));
    }
}
